
<%@ page contentType="text/html;charset=UTF-8" language="java"  import="java.util.*" trimDirectiveWhitespaces="true" %>
<%@include file="/WEB-INF/pages/common/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>拍照邮寄</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <%@include file="/WEB-INF/pages/common/commonCss.jsp"%>
    <link rel="stylesheet" href="${basePath}/resources/css/select2.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/uniform.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/matrix-style.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/matrix-media.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/bootstrap-wysihtml5.css" />

</head>

<style>
    .select2-container {
        float:left;
        width: 35%;
    }
</style>
<body>

<!--Header-part-->
<%@include file="/WEB-INF/pages/common/head.jsp"%>


<!--sidebar-menu-->
<%@include file="/WEB-INF/pages/common/left.jsp"%>

<div id="content">
    <div id="content-header">
        <div id="breadcrumb"> <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>首页</a>
            <a href="#" class="current">拍照邮寄</a> </div>
        <%--<h1>平台商品新增</h1>--%>
    </div>

    <div class="container-fluid">

        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span>
                        <h5></h5>
                    </div>
                    <div class="widget-content nopadding">
                        <form action="${adminPath}/order/saveOrderPicture"  id="form"  method="POST" class="form-horizontal" >
                            <input type="file" class="hidden" id="file" name="file"  accept="image/jpeg,image/png,image/gif,audio/mp3"  onchange="uploadFile()" />
                            <input type="hidden" name="orderno" value="${orderno}">
                            <input type="hidden" name="type" value="${type}">
                            <input type="hidden" name="openid" value="${openid}">
                            <div class="control-group">
                                <label class="control-label">快递公司编码:</label>
                                <div class="controls">
                                    <input  list="cars" name="logisticsnocomp" id="logisticsnocomp"/>
                                    <datalist id="cars">
                                        <c:forEach items="${express}" var="item">
                                            <option value="${item.number}">${item.company}</option>
                                        </c:forEach>
                                    </datalist>
                                    <%--<select style="" name="logisticsnocomp" id="logisticsnocomp">--%>
                                        <%--<c:forEach items="${express}" var="item">--%>
                                            <%--<option value="${item.number}">${item.company}</option>--%>
                                        <%--</c:forEach>--%>
                                    <%--</select>--%>
                                    <span style="color:green">（可根据快递公司第一个首字母大写提示选择）</span>
                                </div>
                            </div>




                            <div class="control-group">
                                <label class="control-label">发货单号 :</label>
                                <div class="controls">
                                    <input type="text" class="span8"  name="logisticsno" placeholder="发货单号"  id="logisticsno">
                                </div>
                            </div>



                            <div id="p_colorCode">
                                <div class="control-group">

                                    <label class="control-label">
                                        <i class="icon-plus" style="margin-right: 1rem" onclick="good.addColor()"></i>
                                        上传图片1(860*860):</label>
                                    <input type="hidden" name="imgurl" >
                                    <div class="controls">
                                        <img  data-img="${good.bannerurl}" onclick="openBrowse(this,0)" data-dir="good/images" src="${basePath}/resources/images/noimage.gif" alt="">
                                    </div>
                                </div>

                            </div>


                            <div class="form-actions">
                                <div class="control-group">
                                    <div class="controls">
                                        <button type="button" onclick="good.submit()" class="btn btn-success">保存</button>
                                        <button type="reset" class="btn btn-default"  onclick="history.go(-1)">返回</button>
                                    </div>
                                </div>
                            </div>

                        </form>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>


<!-- Modal -->

</div>



<!--Footer-part-->
<%@include file="/WEB-INF/pages/common/footer.jsp"%>

<!--end-Footer-part-->

<%@include file="/WEB-INF/pages/common/commonJS.jsp"%>
<script src="${basePath}/resources/js/bootstrap.min.js"></script>
<script src="${basePath}/resources/js/jquery.uniform.js"></script>
<script src="${basePath}/resources/js/select2.min.js"></script>
<script src="${basePath}/resources/js/kindeditor-4.1.10/kindeditor.js"></script>
<script src="${basePath}/resources/js/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script src="${basePath}/resources/js/kindeditor-4.1.10/plugins/code/prettify.js"></script>
<script type="text/javascript" src="${basePath}/resources/js/upload/upload.js"></script>


<script>


    var index = 1;
    var good = {
        submit: function () {
            var logisticsnocomp = $('#logisticsnocomp').val();
            var logisticsno = $('#logisticsno').val();
            var mark = false; //图片标示
            $("img").each(function () {
                var $this = $(this);
                console.log($this.attr('src'));
                if ($this.attr('src')=='' || ($this.attr('src').indexOf('resources/images/noimage.gif')!=-1)) {
                    mark = true;
                }
            });
             console.log("mark==="+mark);

            if (isEmpty(logisticsnocomp)) {
                loading("请选择快递公司", 4);
                return;
            }
            if (isEmpty(logisticsno)) {
                loading("请填写发货单号", 4);
                $("#logisticsno").focus();
                return;
            }
            if (mark) {
                loading("还有未上传的图片", 4);
                return;
            }
            $('#form').submit();
        },

        //新增颜色
        addColor:function(){
            index++;
            $("#p_colorCode").append("<div class='control-group'>"+

                "<div class='control-group' >"+
                "  <label class='control-label'>图片(860*860)"+index+"</label>"+
                "  <input type='hidden' name='imgurl' >"+
                "  <div class='controls'>"+
                "<img  data-img='' onclick='openBrowse(this,0)' data-dir='good/images' src='xxx' alt=''>" +
                "</div>");
            imgerr.init();
        }
    };

    function tz_uploadsuccess(jdata ,obj) {
        if (jdata.target ==0) {
            console.log(JSON.stringify(jdata.name) );
            $(obj).attr("src", basePath + "/" + jdata.url + "?" + new Date().getTime());
            $(obj).parent().prev().val(JSON.stringify(jdata.name));
//          $("#bannerurl").val(JSON.stringify(jdata.name));
        } else if (jdata.target == "#audio") {
            $(jdata.target).attr("src", basePath + "/" + jdata.url).data("link", jdata.url);
            $("#musictitle").val(jdata.name);
            $("#musicsize").val(jdata.size);
            $("#musiclink").val(jdata.url);
            adminBlog.audioDom.oncanplaythrough = function () {
                var time = this.duration;
                var m = Math.ceil(time / 60);
                var s = Math.ceil(time % 60);
                if (m < 10) m = "0" + m;
                if (s < 10) s = "0" + s;
                $("#musictime").val(m + ":" + s);
            }
        }
    }


</script>
<script>
    imgerr.init();
</script>
</body>
</html>
